package cz.kfad.ofrss.model;


import java.util.Date;

public class RssFeed {

    private int id;

    private int channelId;

    private String title;

    private String text;

	private String content;

	private int contentAttempts = 0;

    private String url;

    private int hash;

    private boolean read;

    private Date date;


    public int getChannelId() {
        return channelId;
    }

    public void setChannelId(int channelId) {
        this.channelId = channelId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public RssFeed() {
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public RssFeed(int id, String title, String text, Date date) {
        this.id = id;
        this.title = title;
        this.text = text;
        this.date = date;
    }

    public boolean isRead() {
        return read;
    }

    public void setRead(boolean read) {
        this.read = read;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public int getContentAttempts() {
		return contentAttempts;
	}

	public void setContentAttempts(int contentAttempts) {
		this.contentAttempts = contentAttempts;
	}

	public int getHash() {
        return hash;
    }

    public void setHash(int hash) {
        this.hash = hash;
    }

    @Override
    public String toString() {
        return "RssFeed{" +
                "id=" + id +
                ", channelId=" + channelId +
                ", title='" + title + '\'' +
                ", text='" + text + '\'' +
                ", url='" + url + '\'' +
                ", hash=" + hash +
                ", read=" + read +
                ", date=" + date +
                '}';
    }

    @Override
    public int hashCode() {
        return title.hashCode() * 7 + url.hashCode() * 3;
    }

	public void increaseContentAttempts() {
		contentAttempts++;
	}
}
